<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<jsp:include page="../../common/assets_header.jsp"/>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
jQuery(document).ready(function() {    
});

	function check() {
		document.getElementById('ok').disabled = 'disabled';
	}

	function backrolelist() {
		$("#roleform").attr("action","<%=request.getContextPath()%>/module/role/list" );
		$("#roleform").submit();
	
/* 	function selectThis(id){
		
	} */
	
}
</script>
</head>
<body >


	<!-- content -->
		<div class="page-content">
			
		<div class="page-header">
				<h1>
					<c:if test="${module.module_role_id==null }"><spring:message code="btn.common.add.role"/></c:if>
						<c:if test="${module.module_role_id!=null }"><spring:message code="btn.common.edit.role"/></c:if>
								<small>
									<i class="icon-double-angle-right"></i>
									
								</small>
							</h1>
							
					
			</div>
				<!-- END PAGE HEADER-->
				<div class="row">
					<c:if test="${success}">
						<div class="alert alert-success">
									<button class="close" data-dismiss="alert"></button>
									<strong><spring:message code="success"></spring:message>!</strong> <spring:message code="save success"></spring:message>！
								</div>
					</c:if>
					
					<c:if test="${success==false}">
						<div class="alert alert-failure">
									<button class="close" data-dismiss="alert"></button>
									<strong><spring:message code="failure"></spring:message>!</strong> ${message}
								</div>
					</c:if>
				
					<div class="col-xs-12">
					<form action="<c:if test="${modulerole.moduleRoleId==null}">add</c:if>
							<c:if test="${modulerole.moduleRoleId!=null}">edit</c:if>" 
							method="post" class="form-horizontal" id="roleform" onsubmit="return check();"  class="form-horizontal">
							<input type="hidden" name="sorting_column_order" id="sorting_column_order" value="${sorting_column_order }"/>
								<input type="hidden" name="sorting_asc_desc"  id="sorting_asc_desc" value="${sorting_asc_desc}"/>
								<input type="hidden" name="searchValue"  value="${searchValue}"/>
								<input type="hidden" name="rList" value="${moduleList}"/> 
								<input type="hidden" name="id" value="${modulerole.moduleRoleId}"></input>
								<input type="hidden" name="token" value="${token}"></input>
								
								<%-- <div class="control-group">
								<label class="control-label">模块编号:</label>
									<div class="control-group">
									<div class="controls">
									 <select tabindex="1" data-placeholder="Choose a moduleInfoCode"
										class="span2 m-wrap" name="moduleInfoCode" onChange="selectThis(this);" id="listModuleInfo">
										<option value="-1">--请选择--</option>
											<c:forEach var="moduleInfo" items="${listModuleInfos}" >
												<option value="${moduleInfo.moduleInfoId}">${moduleInfo.moduleInfoId}</option>
											</c:forEach>
									</select>  
									</div>
								</div> --%>
								
								<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1">模块名称:</label>
									<div class="controls">
									
									 <select tabindex="1" data-placeholder="Choose a moduleInfoCode"
										class="m-wrap" style="width: 150px"  name="moduleInfoId" 
										<c:if test="${modulerole.moduleInfoId!=moduleInfo.moduleInfoId}">disabled="disabled"  </c:if>
										>
										<option value="-1">--请选择--</option>
										<%-- <c:forEach var="moduleInfo" items="${listModuleInfos}">
											<option  <c:if test="${searchValue==moduleInfo.moduleInfoId} ">selected="selected"</c:if>
												value="${moduleInfo.moduleInfoId} ">${moduleInfo.moduleInfoId}</option>
										</c:forEach> --%>
											<c:forEach var="moduleInfo" items="${listModuleInfos}">
											<option
											<c:if test="${modulerole.moduleInfoId==moduleInfo.moduleInfoId}">selected="selected"  </c:if>
											value="${moduleInfo.moduleInfoId}">${moduleInfo.moduleName}</option>
											</c:forEach>
									</select>  
									<span class="help-inline"></span>
									</div>
								</div>
								
								<div class="form-group">
								<label class="col-sm-3 control-label no-padding-right" for="form-field-1">角色名：</label>
									<div class="controls">
										<input type="text" maxLength="200" 
												<%-- <c:if test="${modulerole.module_role_id!=null}">disabled="disabled"</c:if> 
											 		<c:if test="${modulerole.module_role_id!=null}"></c:if>
													name="roleName" value="${modulerole.role_name }"
													class="m-wrap" required /> --%> 
													
													name="roleName" value="${modulerole.roleName}"  class="m-wrap" required
													/>
												 <c:if test="${modulerole.moduleRoleId!=null}"> 
														<input type="hidden" name="role_name"	value="${modluerole.roleName}"></input>
												</c:if> 
												
								<span class="help-inline"></span>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right" for="form-field-1">备注：</label>
							<div class="controls">

								<input type="text" maxlength="200" name="roleDesc"
									value="${modulerole.roleDesc}" class="m-wrap" required />
								<span class="help-inline"></span>

							</div>
						</div>
						
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right" for="form-field-1">是否默认角色：</label>
							<div class="controls">

							<%-- 	<input type="text" maxlength="200" name="isDefaultRole"
									value="${modulerole.isDefaultRole}" class="m-wrap" required /> --%>
								
									<input type="radio" name="isDefaultRole" value="0" <c:if test="${modulerole.isDefaultRole==0}">checked="checked"</c:if>  >否
								
								
								
									<input type="radio" name="isDefaultRole" value="1" <c:if test="${modulerole.isDefaultRole!=0 }">checked="checked"</c:if>>是
							
									
									
								<span class="help-inline"></span>

							</div>
						</div>

						<div class="form-actions center">
							<button type="submit" class="btn btn-xs btn-primary" id="ok"><spring:message code="btn.common.save"></spring:message></button>
				
							<button type="button" onclick="backrolelist();" class="btn btn-xs btn-primary"><spring:message code="btn.common.back"></spring:message></button>
				
						</div>
								
					</form>
								
				</div>
				
				</div>
		</div>
		

	<!-- content end -->




</body>
</html>